package com.link2room.ironhide.facade.impl;

import com.link2room.common.dto.param.base.BaseL2rParamDto;
import com.link2room.common.entity.BaseEntity;
import com.link2room.common.jpa.criteria.CriteriaUtil;
import com.link2room.common.jpa.result.QueryResult;
import com.link2room.common.service.ICommonService;
import com.link2room.common.util.ClassConverUtil;
import com.link2room.ironhide.dto.result.base.L2RGroupBrandDto;
import com.link2room.ironhide.entity.L2RGroupBrand;
import com.link2room.ironhide.facade.IGroupBrandFacadeService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.HashMap;

/**
 * Created by sss on 2016/10/25.
 */
@Component("groupBrandFacadeService")
public class GroupBrandFacadeServiceImpl implements IGroupBrandFacadeService {
    @Resource
    private ICommonService commonService;

    @Override
    public QueryResult<L2RGroupBrandDto> listL2RGroupBrand(BaseL2rParamDto baseL2rParamDto)throws Exception{
        L2RGroupBrand queryLGB=new L2RGroupBrand();
        queryLGB.setLhotelGroupCode(baseL2rParamDto.getLhotelGroupCode());
        HashMap<String,String> orderby=new HashMap<>();
        orderby.put(BaseEntity.BaseEntity_.listOrder.toString(), CriteriaUtil.ASC);
        QueryResult<L2RGroupBrand> l2RGroupBandlResult=commonService.findAllEQ(L2RGroupBrand.class,queryLGB,null,null,orderby,null);
        return ClassConverUtil.copyQueryResultToDtoQueryResult(l2RGroupBandlResult,L2RGroupBrandDto.class, false);
    }
}
